Initializes a new instance of the EntitySpan class.
Syntax
Visual Basic (Usage) | Copy Code |
---|
Dim fromType As Type
Dim entityRelations() As EntityRelation
Dim instance As New EntitySpan(fromType, entityRelations) |
Parameters
- fromType
- Root Entity type
- entityRelations
- One or more entity relations
Exceptions
Example
C# | Copy Code |
---|
public void FindEntityGraph() {
DomainModelEntityManager mgr = new DomainModelEntityManager();
// Preload some data into cache for this example.
var emp = mgr.Employees.Where(e => e.Id == 1).Include("OrderSummaries.OrderDetails.Product").ToList().First();
// Get a product for this example.
Product p = mgr.FindEntities<Product>(EntityState.Unchanged).First();
// Now retrieve an object graph for the selected product.
var roots = new List<Entity> { p };
// Add spans - we want any order details using this product, their orders, and the employees.
// Note you must be able to "walk" all relations in the single EntitySpan, if you can't then
// you should use additional EntitySpans.
EntitySpan span1 = new EntitySpan(typeof(Product),
EntityRelations.FK_Order_Details_Products,
EntityRelations.FK_Order_Details_Orders,
EntityRelations.FK_OrderSummary_Employee);
var spans = new List<EntitySpan> { span1 };
// Get the entity graph
var entityGraph = mgr.FindEntityGraph(roots, spans, EntityState.Unchanged);
} |
Remarks
Requirements
Target Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, Windows Vista, Windows Server 2008 family
See Also